package com.example.huhu.ch01;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //创建下拉列表组件
        Spinner position = (Spinner) findViewById( R.id.spinner);
        //创建一个下拉列表选项数组
        String [] strs = {"总裁","经理","秘书"};
        //创建一个数组适配器
        ArrayAdapter aa = new ArrayAdapter(this,android.R.layout.simple_spinner_dropdown_item,strs);
        //设置下拉列表的适配器
        position.setAdapter(aa);
    }
}
